package cn.snowheart.facade;

/**
 * 封装、简化、固化顺序一组方法的调用
 *
 * @author liuwanxiang
 * @version 2018/07/29
 */
public class Computer {

    private CPU cpu;
    private Disk disk;
    private Memory memory;

    public Computer(CPU cpu, Disk disk, Memory memory) {
        this.cpu = cpu;
        this.disk = disk;
        this.memory = memory;
    }

    public void startup() {
        System.out.println("Computer is starting~");
        cpu.startup();
        disk.startup();
        memory.startup();
        System.out.println("Computer is started ok~");
    }

    public void shutdown() {
        System.out.println("Computer is shutting~");
        cpu.shutdown();
        disk.shutdown();
        memory.shutdown();
        System.out.println("Computer is shutted ok~");
    }

}
